version 14.2
#delimit ;
log using "F:\Government Formation in Asian-Pacific Democracies.log", replace;
set more off;

* ***************************************************************** *;
* ***************************************************************** *;
* File-Name: model3_pp.do *;
* Date: 5/30/2022 *;
* Author: MG *;
* Purpose: Analysis [Coalition Clusters] *;
* Input File: data_stata_pp.dta *;
* Data Output: None *;
* Previous file: None *;
* Machine: laptop *;
* **************************************************************** *;
* **************************************************************** *;

use "F:\Government Formation in Asian-Pacific Democracies\Portfolio Allocation\data_stata_pp.dta", clear;


gen portfolioshare = . ;

replace portfolioshare = party_port2/gov_port2 ;

gen seatshare = . ;

replace seatshare = party_seats/gov_seats ;

gen parliamentary = . ;
 
replace parliamentary = 1 if presidential ==0 ;

replace parliamentary = 0 if presidential == 1 ;

gen seatshare_parl = . ;

replace seatshare_parl = seatshare * parliamentary ;

gen formateur_parl = . ;

replace formateur_parl = formateur * parliamentary ;

gen seat_partyinst = . ;

replace seat_partyinst = seatshare * party_inst ;

gen partyinst_parl = . ;

replace partyinst_parl = party_inst * parliamentary ;

gen formateur_partyinst = . ;

replace formateur_partyinst = formateur * party_inst ;

gen form_partyinst_parl = . ;

replace form_partyinst_parl = formateur * party_inst * parliamentary ;

gen seat_partyinst_parl = . ;

replace seat_partyinst_parl = seatshare * party_inst * parliamentary ;

************************* ;
*  Summarize variables    ;
************************* ;

sum;


********************************************************************** ;
*  Table 1, Model 3, re-arranged to put seatshare IVs last           ;
* Y = b0 + b1X + b2W + b3Z + b4XW + b5XZ + b6WZ * b7XZW + controls + e ;
*    formateur is X, parliamentary is W, party_inst is Z               ;
* formateur_parl is XW, formateur_partyinst= XZ, partyinst_parl is WZ, ; 
* form_partyinst_parl is XWZ, then control variables                   ; 
********************************************************************** ;

regress portfolioshare formateur parliamentary party_inst 
formateur_parl formateur_partyinst partyinst_parl 
form_partyinst_parl 
seatshare seatshare_parl seat_partyinst seat_partyinst_parl, cluster(cabinetcode) ;
 
 
log close;
exit;

